import request from '@/utils/request'
import { commercialApiUrl }  from "../config"

// 工作总计划分页
export function masterWorkPlanByPage(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/findListByMain`,
    method: 'post',
    data
  })
}

// 工作总计划-统计
export function masterWorkPlanCount(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/findListCount`,
    method: 'post',
    data
  })
}

// 工作总计划-详情统计
export function masterWorkPlanDetailCount(params) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/findListByMainId`,
    method: 'get',
    params
  })
}

// 历史版本列表
export function masterWorkPlanFindListByMainHistoryList(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/findListByMainHistory`,
    method: 'post',
    data
  })
}


// 工作总计划-详情列表
export function masterWorkPlanDetailByPage(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/findListByDetails`,
    method: 'post',
    data
  })
}

// 工作总计划-详情列表
export function updateDeatilsByProjetId(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/updateDeatilsByProjetId`,
    method: 'get',
    params: data
  })
}


// 工作总计划-列表导出
export function masterWorkPlanExportExcelByPage(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/exportByList`,
    method: 'post',
    responseType: 'arraybuffer',
    data
  })
}


// 工作总计划-详情列表导出
export function masterWorkPlanExportExcel(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/export`,
    method: 'post',
    responseType: 'arraybuffer',
    data
  })
}

// 工作总计划-保存草稿、提交
export function masterWorkPlanSaveOrSubmit(data) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/editByMain`,
    method: 'post',
    data
  })
}

// 工作总计划-校验工程内控计划
export function masterWorkPlanChecked(projectId) {
  return request({
    url: `${commercialApiUrl}/masterWorkPlan/checkProjectMasterPlan/${projectId}`,
    method: 'post'
  })
}